package com.jmc.calls;
import java.io.IOException;
import java.util.Enumeration;

import com.ibm.as400.access.AS400;
import com.ibm.as400.access.AS400Exception;
import com.ibm.as400.access.AS400SecurityException;
import com.ibm.as400.access.ErrorCompletingRequestException;
import com.ibm.as400.access.ObjectDoesNotExistException;
import com.ibm.as400.access.RequestNotSupportedException;
import com.ibm.as400.access.User;
import com.ibm.as400.access.UserList;


public class TestListUser {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		 AS400 as400 = new AS400("www.coinse.com.ar","jfb","jfb");
		 UserList userList = new UserList( as400 );
		 Enumeration e = null;
		try {
			e = userList.getUsers();
		} catch (AS400Exception e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (AS400SecurityException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (ErrorCompletingRequestException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (InterruptedException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (ObjectDoesNotExistException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (RequestNotSupportedException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		 while (e.hasMoreElements ())
		 {
		   User u = (User) e.nextElement ();
		   System.out.println (u.getDescription());
		 }

	}

}
